<?php

declare(strict_types=1);

use Hyperf\HttpServer\Router\Router;

/**
 * Http 路由：
 */

Router::get('/favicon.ico', function () { return ''; });

Router::addRoute(['GET', 'POST', 'HEAD'], '/',    'App\Controller\IndexController@index');

Router::addRoute(['GET', 'POST', 'HEAD'], '/test', 'App\Controller\TestController@index');

Router::addRoute(['GET', 'POST', 'HEAD'], '/api',  'App\Controller\ApiController@index');


/**
 * WebSocket 路由：
 * 'ws' 对应于 '/config/autoload/server.php' 文件 'servers' 配置项 'name' => 'ws'
 */

Router::addServer('ws', function () {

    Router::get('/', function () { return ''; });

    Router::get('/ws', \App\Controller\WebSocketController::class);
});

